const {mysql} = require('../qcloud')

module.exports = async (ctx) => {
  const {openid} = ctx.request.query
  try{
    const tour = await mysql('strategy')
                              .select('sid','sbiao','ssrc','szheng')//sid攻略的id 
                              .where("openid",openid)//删掉该句即可显示所有
                              .orderBy('sid','desc') //降序
    // 执行成功返回的数据
    ctx.state.data = {
      tour
    }
  }catch(e){
    // 执行失败返回的数据
    ctx.state = {
      code: -1,
      data: {
        msg: '获取失败' + e.sqlMessage
      }
    }
  }
}
